package com.zhang.server;

import com.zhang.codec.ObjDecoder;
import com.zhang.codec.ObjEncoder;
import com.zhang.domain.MsgInfo;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

import java.nio.charset.Charset;

public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {



    @Override

    protected void initChannel(SocketChannel channel) {
        //对象传输处理

        channel.pipeline().addLast(new ObjDecoder(MsgInfo.class));

        channel.pipeline().addLast(new ObjEncoder(MsgInfo.class));

        // 在管道中添加我们自己的接收数据实现方法

        channel.pipeline().addLast(new MyServerHandler());

    }



}

